package com.mingle.iwalk;

import java.util.List;
import android.database.Cursor;
import android.location.Location;

public class TrackInfo extends TravelerInfo {

	public static 	int 		TRACK_STATE_IDLE 	= 0;
	public static 	int 		TRACK_STATE_RUNNING = 1;
	
	public List<Location>	trackList;
	public String			trackPath = "";
	public int				trackState = TRACK_STATE_IDLE;
	
	public TrackInfo()
	{
		this.type 					= INFO_TYPE_TRACK;
	}
	
	@Override
	public TravelerInfo convert2TravelerInfo(Cursor cursor) {
		super.convert2TravelerInfoBase(cursor);
		
    	String trackPath = cursor.getString(cursor.getColumnIndex(TravelerDB.TRACK_PATH));
    	int trackCount = cursor.getInt(cursor.getColumnIndex(TravelerDB.TRACK_COUNT));
    	int trackState = cursor.getInt(cursor.getColumnIndex(TravelerDB.TRACK_STATE));
    	
    	this.trackPath = trackPath;
    	this.trackState= trackState;
    	try {
			this.trackList = Utils.parseTrackPath(trackPath);
		} catch (Exception e) {
			this.trackList = null;
			e.printStackTrace();
		}
    	
		return this;
	}
}
